﻿ @{
     Layout = "~/Views/Shared/Part_Layout.cshtml";  
 }
@model FreightSoft.Models.PART

@{
    FreightSoft.Models.Entities db = new FreightSoft.Models.Entities();
}

@{
    ViewBag.Title = "Create";
}

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>New Part</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.PART_ID)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.PART_ID, new { @readonly = "readonly", Value = db.PARTs.Max(p => p.PART_ID) + 1 })
            @Html.ValidationMessageFor(model => model.PART_ID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PART_DESC)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PART_DESC)
            @Html.ValidationMessageFor(model => model.PART_DESC)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.VOLUME)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.VOLUME)
            @Html.ValidationMessageFor(model => model.VOLUME)
        </div>

        <input type="checkbox" value="Not Applicable" name="VolNotApplicable" onclick="document.getElementById('VOLUME').value = 0.0;"/> Volume Not Applicable

        <div class="editor-label">
            @Html.LabelFor(model => model.WEIGHT)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.WEIGHT)
            @Html.ValidationMessageFor(model => model.WEIGHT)
        </div>

        <input type="checkbox" value="Not Applicable" name="WeiNotApplicable" onclick="document.getElementById('WEIGHT').value = 0.0;"/> Weight Not Applicable

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}
